﻿@using Abp.Web.Mvc.Extensions
@using Microsoft.Owin.Security
@model LearningMpaAbp.Web.Models.Account.LoginFormViewModel
@section Styles
{
    @Html.IncludeStyle("~/Views/Account/Login.css")
}
@section Scripts
{
    @Html.IncludeScript("~/Views/Account/Login.js")
}
<div class="container">
    <div id="LoginArea" class="row">
        <div class="col-lg-12">
            <div class="well bs-component">
                <form id="LoginForm" class="form-horizontal" action="@(Url.Action("Login", "Account"))?returnUrl=@(Model.ReturnUrl)" method="POST">
                    <fieldset>
                        <legend>@L("LogIn")</legend>

                        @if (Model.IsMultiTenancyEnabled)
                        {
                            <div class="form-group">
                                <div class="col-lg-12">
                                    <input type="text" class="form-control" id="TenancyName" placeholder="@L("TenancyName")" required maxlength="@LearningMpaAbp.MultiTenancy.Tenant.MaxTenancyNameLength">
                                    <span class="text-muted">@L("CanBeEmptyToLoginAsHost")</span>
                                </div>
                            </div>
                        }
                        else
                        {
                            <input type="hidden" id="TenancyName" value="">
                        }

                        <div class="form-group">
                            <div class="col-lg-12">
                                <input type="text" class="form-control" id="EmailAddressInput" placeholder="@L("UserNameOrEmail")" required maxlength="@LearningMpaAbp.Users.User.MaxEmailAddressLength">
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-lg-12">
                                <input type="password" class="form-control" id="PasswordInput" placeholder="@L("Password")" required maxlength="@LearningMpaAbp.Users.User.MaxPlainPasswordLength">
                                <div class="checkbox">
                                    <label>
                                        <input type="checkbox" id="RememberMeInput">
                                        <span class="ripple"></span>
                                        <span class="check"></span> @L("RememberMe")
                                    </label>
                                </div>
                            </div>
                        </div>

                        <input id="ReturnUrlHash" type="hidden" name="returnUrlHash" />

                        <div class="form-group">
                            <div class="col-lg-12">
                                <button id="LoginButton" type="submit" class="btn btn-primary"><i class="fa fa-sign-in"></i> @L("LogIn")</button>
                                <a class="btn btn-success" href="@Url.Action("Register")"><i class="fa fa-sign-in"></i> @L("Register")</a>
                            </div>
                        </div>
                    </fieldset>
                </form>

                @{
                    var loginProviders = Context.GetOwinContext().Authentication.GetExternalAuthenticationTypes().ToList();
                }

                @if (loginProviders.Count > 0)
                {
                    <p>@L("OrLoginWith"):</p>
                    

                    using (Html.BeginForm("ExternalLogin", "Account", method: FormMethod.Post))
                    {
                        @Html.AntiForgeryToken()

                        <input type="hidden" name="returnUrl" value="@ViewBag.ReturnUrl" />
                        <input type="hidden" name="provider" value="" />

                        foreach (var provider in loginProviders)
                        {
                            <a class="btn btn-default btn-sm social-login-link" title="@provider.AuthenticationType"
                               data-provider="@provider.AuthenticationType"
                               href="javascript:;">
                                <i class="fa fa-@(provider.AuthenticationType.ToLower())"></i> @provider.AuthenticationType
                            </a>
                        }
                    }
                }

            </div>
        </div>
    </div>
</div>